package com.icare.trade.server.rest;

import com.icare.shop.common.base.ResponseResult;
import com.icare.trade.server.resp.GoodsResp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

/**
 * <pre>
 *    author  : tianhaibo
 *    email   : tianhaibo@jshuii.com
 *    time    : 2020/3/15   21:55
 *    desc    :
 *    version : v1.0
 * </pre>
 */
@Slf4j
@RestController
@RequestMapping("v1")
@Api(tags = "商品",value = "商品")
public class GoodsRest {

    @GetMapping("getShopInfo")
    @ApiOperation("查询商品")
    public ResponseResult<GoodsResp> getShopInfo(@RequestParam("id")Long id){
        GoodsResp goodsResp = GoodsResp.builder()
                .id(id)
                .name("商品" + (int) (Math.random() * 10))
                .desc("描述")
                .price(new BigDecimal(9.9))
                .build();
        return ResponseResult.success(goodsResp);
    }
}
